From 649ac44dd9a98aeebfc29a5069fc6656ac1f0ea0 Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Thu, 15 Jan 2009 09:51:07 +0000 Subject: [PATCH] Don't assume actions and results have equal height This causes negative size requisitions when results are more than one line tall. * gtk/gtkentrycompletion.c: change the formula used to calculate the size of the completion popup. svn path=/trunk/; revision=22120 --- ChangeLog | 12 ++++++++++++ gtk/gtkentrycompletion.c | 9 +++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5fec0e3d5..3ec12a7367 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-01-15 Diego Escalante Urrelo + + Bug 562701 – GtkEntryCompletion popup sizes its rows wrong + when they span for more than one line. + + Don't assume actions and results have equal height, this causes + negative size requisitions when results are more than one + line tall. + + * gtk/gtkentrycompletion.c: change the formula used to calculate + the size of the completion popup. + 2009-01-14 Federico Mena Quintero Remember the file chooser's geometry across invocations. diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c index 932637488a..e0fdeca7a7 100644 --- a/gtk/gtkentrycompletion.c +++ b/gtk/gtkentrycompletion.c @@ -1375,6 +1375,8 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion) GtkTreePath *path; gboolean above; gint width; + GtkTreeViewColumn *action_column; + gint action_height; if (!completion->priv->entry->window) return FALSE; @@ -1384,9 +1386,12 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion) matches = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL); actions = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->actions), NULL); + action_column = gtk_tree_view_get_column (GTK_TREE_VIEW (completion->priv->action_view), 0); gtk_tree_view_column_cell_get_size (completion->priv->column, NULL, NULL, NULL, NULL, &height); + gtk_tree_view_column_cell_get_size (action_column, NULL, + NULL, NULL, NULL, &action_height); gtk_widget_style_get (GTK_WIDGET (completion->priv->tree_view), "vertical-separator", &vertical_separator, @@ -1404,9 +1409,9 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion) if (y > monitor.height / 2) - items = MIN (matches, (monitor.y + y) / height - actions); + items = MIN (matches, (((monitor.y + y) - (actions * action_height)) / height) - 1); else - items = MIN (matches, (monitor.height - y) / height - 1 - actions); + items = MIN (matches, (((monitor.height - y) - (actions * action_height)) / height) - 1); if (items <= 0) gtk_widget_hide (completion->priv->scrolled_window); -- 2.30.2